package lines.gameengine;

import org.junit.Before;
import org.junit.Test;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;

/**
 * @author vpotapenko
 */
public class CellTest {

    private static final int X = 5;
    private static final int Y = 12;

    private Cell cell;

    @Before public void setUp() throws Exception {
        cell = new Cell(X, Y);
    }

    @Test public void shouldInitializePointOnCreation() {
        final FieldPoint point = cell.getPoint();

        assertThat(point.getX(), equalTo(X));
        assertThat(point.getY(), equalTo(Y));
    }

    @Test public void shouldClearBall() {
        final IBall ball = new Ball(null);

        cell.setBall(ball);
        assertThat(cell.getBall(), equalTo(ball));

        cell.clear();
        assertThat(cell.getBall(), nullValue());
    }
}
